export default function parseAttrsString(attrsString) {
  if (attrsString === undefined) {
    return []
  }
  let isYinHao = false
  let point = 0
  let result = []
  for (let i = 0; i < attrsString.length; i++) {
    let char = attrsString.charAt(i)
    if (char === '"') {
      isYinHao = !isYinHao
    }
    if (char === " " && !isYinHao) {
      if (!/^\s*$/.test(attrsString.substring(point, i))) {
        result.push(attrsString.substring(point, i).trim())
        point = i
      }
    }
  }
  result.push(attrsString.substring(point).trim())
  return result.map(item => {
    let arr = item.match(/^(.+)="(.+)"$/)
    return {
      name: arr[1],
      value: arr[2]
    }
  })
}
